package com.ray.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ray.bean.PageParamBean;
import com.ray.mapper.PageParamMapper;

@Service
public class PageParamService {
	@Autowired
	PageParamMapper pageParamMapper;

	public void setReachParam(PageParamBean pageParamBean) {
		PageParamBean pageParam=pageParamMapper.getPageParam(pageParamBean.getUserId());
		if(null==pageParam) {
			pageParamMapper.insertPageParam(pageParamBean);
		}else {
			pageParamMapper.updataPageParam(pageParamBean);
		}
	}

	public PageParamBean getReachParam(String userId) {
		PageParamBean pageParam=pageParamMapper.getPageParam(userId);
		if(null==pageParam||null==pageParam.getReachParam()) {
			pageParam.setReachParam("数控");
		}
		return pageParam;
	}

}
